<!DOCTYPE html>
<html lang="en">
<head>
  <meta charset="UTF-8">
  <meta http-equiv="X-UA-Compatible" content="IE=edge">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <title>4.3弹性盒子布局</title>
  <style>
    .box1{
      height: 200px;
      border: 1px solid red;
      display: flex;
      flex-direction: row;
    }
    .box1 .item1 {
      background: chartreuse;
      width: 100px;
    }
    .box1 .item2 {
      background: yellowgreen;
      flex: 1;
    }
    .box1 .item3 {
      background: blanchedalmond;
      flex: 2;
    }
    .box2{
      height: 200px;
      border: 1px solid red;
      display: flex;
      flex-direction: column;
    }
    .box2 .item1 {
      background: chartreuse;
      height: 100px;
    }
    .box2 .item2 {
      background: yellowgreen;
      flex: 1;
    }
    .box2 .item3 {
      background: blanchedalmond;
      flex: 2;
    }
    .box3{
      height: 200px;
      border: 1px solid red;
      display: flex;
      flex-direction: column;
      align-items: center;
      justify-content: center;
    }
    .box3 .item1 {
      background: chartreuse;
    }
  </style>
</head>
<body>
  <h3>子项水平排放</h3>
  <div class="box1">
    <div class="item1">item1</div>
    <div class="item2">item2</div>
    <div class="item3">item3</div>
  </div>
  <h3>子项垂直排放</h3>
  <div class="box2">
    <div class="item1">item1</div>
    <div class="item2">item2</div>
    <div class="item3">item3</div>
  </div>
  <h3>子项水平-垂直居中</h3>
  <div class="box3">
    <div class="item1">item1</div>
  </div>
</body>
</html>